<!DOCTYPE html>
<html lang="en">
<head>
    <title>服务信息</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="${base}/res/manage/css/common.css">
    <link href="${base}/res/manage/css/ec.css" rel="stylesheet">
    <link href="${base}/res/manage/css/list.css" rel="stylesheet">
    <script type="text/javascript" src="${base}/res/plugin/jquery/jquery-1.7.2.js"></script>
    <script type="text/javascript" src="${base}/res/plugin/validator/jquery.validate.min.js"></script>
    <script type="text/javascript" src="${base}/res/admin/js/common.js"></script>
    [#include "/admin/include/plupload.ftl" /]
    <script type="text/javascript">
        $(document).ready(function () {

            //图片上传
            var up = extPlupload("${base}", {});

            //表单验证，数据提交
            $("#inputForm").validate({
                rules: {
                    name: {
                        required: true,
                        maxlength: "50"
                    },
                    grade:{
                        required:true,
                        digits:true
                    },
                    num:{
                        required:true,
                        digits:true,
                        maxlength:"4"
                    },
                    orders:{
                        required:true,
                        digits:true
                    },
                    isEnabled:{
                        required:true,
                    },
                    isDefault:{
                        required:true,
                    },
                    remark:{
                        maxlength:128
                    }
                },
                messages: {
                    name: {
                        required: "必填项",
                        maxlength: "最长50个字符"
                    },
                    grade:{
                        required:"必填项",
                        digits:"必须为数字"
                    },
                    num:{
                        required:"必填项",
                        digits:"必须为数字",
                        maxlength:"最长4个字符"
                    },
                    orders:{
                        required:"必填项",
                        digits:"必须为数字"
                    },
                    isEnabled:{
                        required:"必选项"
                    },
                    isDefault:{
                        required:"必须项"
                    },
                    remark:{
                        maxlength:"最长128个字符"
                    }
                },
                submitHandler: function(form) {
                    //表单提交
                    form.submit();

                }
            });
        });
    </script>
</head>
<body>
[#--主体--]
<div class="tab set">
    <h3><a href="list.jhtml">文章分类管理</a><a href="edit.jhtml?id=${articleType.id}">>编辑文章分类 </a></h3>
    <div class="tablist message set">
        <form id="inputForm" name="inputForm" action="update.jhtml" method="post">
        [#--隐藏字段--]
            <input name="id" id="id" value="${articleType.id}" type="hidden"/>
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <td><label>栏目名称<span class="cred"> * </span></label></td>
                    <td>
                        <input type="text" id="name" name="name" value="${articleType.name}"  placeholder="服务名称">
                    </td>

                    <td><label>父级节点</label></td>
                    <td>
                        <select id="parentId" name="parentId">
                            <option value="">请选择</option>
                        [#list articleTypes as temp]
                            [#if !temp.treePath?contains(","+articleType.id+",") && temp.id!=articleType.id]
                                <option value="${temp.id}" [#if temp.id == articleType.parentId]selected[/#if]>
                                    [#if temp.grade != 0]
                                        [#list 1..temp.grade as i]
                                            &nbsp;&nbsp;
                                        [/#list]
                                    [/#if]
                                ${temp.name}
                                </option>
                            [/#if]
                        [/#list]
                        </select>
                        <a href="javascript:;" class="arrows" >∨</a>
                    </td>
                </tr>
                <tr>
                    <td><label>列表页模版</label></td>
                    <td>
                        <select id="listTemp" name="listTemp">
                            <option value="">请选择模版</option>
                        [@stdCode codeType="ARTICLE_LIST_TEMP" all=false]
                            [#list codeMap.entrySet() as entry]
                                <option value="${entry.key}" [#if entry.key == articleType.listTemp]selected[/#if] >${entry.value}</option>
                            [/#list]
                        [/@stdCode]
                        </select>
                        <a href="javascript:;" class="arrows" >∨</a>
                    </td>

                    <td><label>内容页模版</label></td>
                    <td>
                        <select id="contentTemp" name="contentTemp">
                            <option value="">请选择模版</option>
                        [@stdCode codeType="ARTICLE_CONTENT_TEMP" all=false]
                            [#list codeMap.entrySet() as entry]
                                <option value="${entry.key}" [#if entry.key == articleType.contentTemp]selected[/#if] >${entry.value}</option>
                            [/#list]
                        [/@stdCode]
                        </select>
                        <a href="javascript:;" class="arrows" >∨</a>
                    </td>
                </tr>
                <tr>
                    <td><label>排序<span class="cred"> * </span></label></td>
                    <td>
                        <input type="text" id="orders" maxlength="11" name="orders" value="${articleType.orders}" placeholder="排序(不超过11个字符长度)">
                    </td>

                    <td><label>每页条数<span class="cred"> * </span></label></td>
                    <td>
                        <input type="text" id="num" name="num" value="${articleType.num}" placeholder="每页显示条数">
                    </td>
                </tr>
                <tr>
                    <td><label>栏目备注</label></td>
                    <td>
                        <textarea maxlength="128" id="remark" name="remark" placeholder="栏目备注(不超过128个字符长度)">${articleType.remark}</textarea>
                    </td>

                    <td><label>栏目封面</label></td>
                    <td>
                        <input placeholder="封面图(请上传360*200像素的图片)" id="fileName" name="image" value="${articleType.image}" type="text" class="uploadTxt"/>
                        <input id="pickfiles" type="button" value="上传" class="uploadBtn"/>
                    </td>
                </tr>
                <tr>
                    <td><label>是否可用<span class="cred"> * </span></label></td>
                    <td>
                        <label><input type="radio" name="isEnabled" class="sex" value="0" [#if !articleType.isEnabled]checked[/#if]>否</label>
                        <label><input type="radio" name="isEnabled" class="sex" value="1" [#if articleType.isEnabled]checked[/#if]>是</label>
                    </td>

                   [#-- <td><label>是否默认<span class="cred"> * </span></label></td>
                    <td>
                        <label><input type="radio" name="isDefault" class="sex" value="0" [#if !articleType.isDefault]checked[/#if]>否</label>
                        <label><input type="radio" name="isDefault" class="sex" value="1" [#if articleType.isDefault]checked[/#if]>是</label>
                    </td>--]
                </tr>
            </table>
            <p class="save">
                <input type="submit" value="保存" class="red">
                <input type="button" value="取消" id="backButton" class="red">
            </p>
        </form>
    </div>
</div>
</body>
</html>